<?php

namespace App\Console\Commands;


use App\Helpers\Curl;
use App\Helpers\Logger\SLogger;
use App\Models\Orm\CoinMarket;
use App\Models\Orm\CoinTicker;
use App\Models\Orm\Product;
use Illuminate\Console\Command;
use DB;

class ProductStatus extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'ProductStatus';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '产品状态更改';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {

        $product = Product::where('name','NowRupiah')->first();

        $status = $product -> status ? 0 : 1;

        $product -> status = $status;

        SLogger::getStream()->info($status);
        $product -> save();

    }
}
